package com.yalemang.photovalut.ui.preview.page

import android.os.Bundle
import com.yalemang.framework.base.BaseFragment
import com.yalemang.photovalut.base.ext.load
import com.yalemang.photovalut.databinding.FragmentPreviewPhotoBinding
import com.yalemang.photovalut.ui.preview.PreviewPhotoModel

class PreviewPhotoFragment: BaseFragment<FragmentPreviewPhotoBinding, PreviewPhotoFragmentPresenter>() {

    private lateinit var photoPath : String

    companion object{
        private const val KEY_PHOTO_PATH = "key_photo_path"

        fun newInstance(photoPath : String) : PreviewPhotoFragment {
            val previewPhotoFragment = PreviewPhotoFragment()
            val bundle = Bundle()
            bundle.putString(KEY_PHOTO_PATH, photoPath)
            previewPhotoFragment.arguments = bundle
            return previewPhotoFragment
        }
    }

    override fun initData() {
        photoPath = requireArguments().getString(KEY_PHOTO_PATH)!!
    }

    override fun initView() {
        mBinding.ivPreviewPhoto.load(photoPath)
    }

    override fun initMVP() {
        mPresenter = PreviewPhotoFragmentPresenter()
        mPresenter.mView = this
        mPresenter.mModel = PreviewPhotoModel()
    }
}